import { tauri } from "@tauri-apps/api";
import { Linkage, NamedPos } from "./model";

export default {

    async saveNamedPos(pos: NamedPos) {
        await tauri.invoke('save_named_pos', {
            pos: pos,
        });
    },

    async delNamedPos(name: string) {
        await tauri.invoke('del_named_pos', {
            name: name,
        });
    },

    async getNamedPos() {
        return await tauri.invoke('get_names_pos') as NamedPos[];
    },

    async saveLinkage(linkage: Linkage) {
        await tauri.invoke('save_linkage', {
            linkage: linkage,
        });
    },

    async delLinkage(name: string) {
        await tauri.invoke('del_linkage', {
            name: name,
        });
    },

    async getLinkage() {
        return await tauri.invoke('get_linkage') as Linkage[];
    },

}

